#include <cstdio>
using namespace std;

const int kMaxXY = 1010;

int sum[kMaxXY][kMaxXY];

int main() {
  int n, K;
  int ans = 0;

  scanf("%d%d", &n, &K);
  for (int i = 0; i < n; i++) {
    int x1, y1, x2, y2;
    scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
    sum[x1 + 1][y1 + 1]++;
    sum[x2 + 1][y2 + 1]++;
    sum[x1 + 1][y2 + 1]--;
    sum[x2 + 1][y1 + 1]--;
  }
  for (int i = 1; i < kMaxXY; i++) {
    for (int j = 1; j < kMaxXY; j++) {
      sum[i][j] += sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1];
      if (sum[i][j] == K) {
        ans++;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}